<?php

namespace app\admin\command;

use app\api\service\wanlshop\Common;
use app\api\service\wanlshop\Goods;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class Sync2 extends Command
{
    protected function configure()
    {
        $this->setName('sync2')
            ->addArgument('c_father_goods_id', null, '三方ID', '')
            ->setDescription('sync goods detail data');
    }

    protected function execute(Input $input, Output $output)
    {
        $id = $input->getArgument('c_father_goods_id');
        if (!$id) {
            $output->writeln("缺少参数c_father_goods_id");
            return;
        }
        $detail = Common::getData('getGoodsDetails', ['father_id' => $id]);
        var_dump($detail);
        if ($detail) {
            $goods = new Goods();
            $goods->singleHandle(0, $detail, $output);
        }
    }
}